public class Poyldrom2 {

	static final int MIN_lENGTH = 3;
	static String[] polyndromArray;
	static int counter = 0;

	public static void main(String args[]) {

		checkArguments(args);
		polyndromArray = new String[args[0].length()];
		String word = args[0];
		word = delleteSpaces(word);
		find(word);
		show(polyndromArray);
	}

	public static void checkArguments(String[] args) {
		if ((args.length < 1) && (args.length > 1)) {
			System.out.println("Bad arguments, enter correct arguments.");
			return;
		} else {
			if (args[0].length() < 3) {
				System.out.println("Bad arguments, enter correct arguments.");
				return;
			}
		}
	}

	static void find(String word) {
		if (word.length() < MIN_lENGTH) {
			return;
		}
		String backword = "";
		word = word.toLowerCase();
		for (int i = word.length() - 1; i >= 0; i--) {
			backword += (char) word.codePointAt(i);
		}
		if (word.equals(backword)) {
			polyndromArray[counter++] = word;
		}
		find(word.substring(1, word.length() - 1));
	}

	static String delleteSpaces(String args) {
		String temp = "";
		for (int i = 0; i < args.length(); i++) {
			if (!args.substring(i, i + 1).equals(" ")) {
				temp = temp + args.substring(i, i + 1);
			}
		}
		return temp;
	}

	static void show(String[] arr) {
		for (String str : arr) {
			if (str != null) {
				System.out.println(str);
			}
		}
	}
}
